<template>
<div>
      <div>审批历史</div>
<div>
      <!-- 导出按钮 -->
       <el-button type="primary" @click="exportExcel">导出文件</el-button>
 <el-table :data="tableData" style="width: 100%" border height="150" id="tableData">
          <el-table-column type="index" label="序号" width="80">
          </el-table-column>
          <!-- <input type="hidden" value="bwid" prop="bwid" /> -->
          <el-table-column prop="step" label="步骤" >
          </el-table-column>
          <el-table-column prop="agent" label="经办人" > </el-table-column>
          <el-table-column prop="suggestion" label="处理意见"> </el-table-column>
          <el-table-column prop="content" label="意见内容"> </el-table-column>
          <el-table-column prop="processingtime" label="处理时间"> </el-table-column>
        </el-table>
</div>
<div style="margin-top:25px">
    <el-row >
  <el-col :span="2" :offset="20">  <el-button size="medium" type="success" plain @click="goBack()">返回</el-button></el-col>
</el-row>

</div>


</div>
 
</template>

<script>
   import FileSaver from "file-saver";
import XLSX from "xlsx";

export default ({
    
  data(){
    return {
   tableData:[]


    }
  },
  created:function() {
    var bwid = this.$route.query.bwid;
    this.allHistroy();
},
   methods:{ 
       
   // 导出表格所用
    exportExcel() {
      // 设置当前日期
      let time = new Date();
      let year = time.getFullYear();
      let month = time.getMonth() + 1;
      let day = time.getDate();
      let hour =time.getHours();
      let minutes = time.getMinutes();
      let second=time.getSeconds();
      let name = year + "" + month + "" + day+""+hour+""+minutes+""+second+ "审批历史";
      // console.log(name)
      /* generate workbook object from table */
      //  .table要导出的是哪一个表格
      var wb = XLSX.utils.table_to_book(document.querySelector("#tableData"));
      /* get binary string as output */
      var wbout = XLSX.write(wb, {
        bookType: "xlsx",
        bookSST: true,
        type: "array"
      });
      try {
        //  name+'.xlsx'表示导出的excel表格名字
        FileSaver.saveAs(
          new Blob([wbout], { type: "application/octet-stream" }),
          name +".xlsx"
        );
      } catch (e) {
        if (typeof console !== "undefined") console.log(e, wbout);
      }
      return wbout;
    },
 
        goBack() {
        this.$router.push("/home")
        },
      allHistroy() {
          console.log("bwid:"+this.$route.query.bwid)
             this.$axios.get("http://localhost:8082/loan/allHistroy", {
               
                 params:{  plid: this.$route.query.bwid,}  
            }).then(resp=>{
                console.log(resp.data);
                this.tableData=resp.data.data
            });
      },
  },
  
})
</script>

<style>

      .el-row {
    margin-bottom: 20px;
  
  }
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
</style>
